package com.app.common.utils;

import com.alibaba.druid.pool.DruidDataSource;
import com.app.common.exception.BusinessException;
import com.app.modules.code.domain.Sysdbconfig;


public class DataSourceComposeUtils {

    public static DruidDataSource composeDruidDataSource(Sysdbconfig dataSource) throws BusinessException {

        DruidDataSource druidDataSource = new DruidDataSource();
        druidDataSource.setUsername(dataSource.getUsername());
        druidDataSource.setPassword(dataSource.getPassword());
        druidDataSource.setDriverClassName(dataSource.getDriver());
        druidDataSource.setUrl(dataSource.getUrl());

        return druidDataSource;
    }
}
